package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品ID来查询对应的套餐id
     * @param dishIds
     * @return
     */
    List<Long>  getSetmealIdByDishIds(List<Long> dishIds);

    /**
     * 插入套餐关联菜品表数据
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);
    /**
     * 根据setmealId查询对应菜品
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> getBySetmealId(Long id);

    /**
     * 根据套餐id删除对应菜品
     * @param id
     */
    @Delete("DELETE FROM Setmeal_dish where setmeal_id = #{id}")
    void deleteBySetmealId(Long id);

    /**
     * 根据套餐id批量删除套餐对应菜品数据
     * @param ids
     */
    void deleteByDishIds(List<Long> ids);
}
